package com.fc.redis.service;

import com.fc.redis.entity.TbUser;
import com.fc.redis.mapper.TbUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * Created By gao_e on 2020/3/18 13:41
 */
@Service
public class TestTransactionalService {

    @Autowired
    private TbUserMapper tbUserMapper;
    @Autowired
    private TestTransactionalService testTransactionalService;

    @Transactional
    public void test() {
        TbUser tbUser = new TbUser(200, "1", "123", "name1", new Date(), new Date());
        tbUserMapper.insert(tbUser);
        int i = 1 / 0;
        tbUser = new TbUser(201, "201", "123", "name1", new Date(), new Date());
        tbUserMapper.insert(tbUser);
    }
    public void f() {
        System.out.println(this);
        System.out.println(testTransactionalService);
        System.out.println(this.getClass());
        System.out.println(testTransactionalService.getClass());
        System.out.println(this == testTransactionalService);
        System.out.println(this.equals(testTransactionalService));
        this.test();
//        testTransactionalService.test();
    }
//    private void f2() {
//        test();
//    }

}
